package com.eedi.framework.oauth2.dal.dataobject;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eedi.framework.common.enums.UserTypeEnum;
import com.eedi.framework.org.core.db.OrgInfoBaseDO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * OAuth2 批准 DO
 *
 * 用户在 sso.vue 界面时，记录接受的 scope 列表
 *
 * @author 永聚长青源码
 */
@TableName(value = "org_oauth2_approve", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
public class OrgOAuth2ApproveDO extends OrgInfoBaseDO {


    /**
     * 业务id
     */
    @TableId(type = IdType.ASSIGN_UUID)
    private String orgOauth2ApproveId;

    /**
     * 用户编号
     */
    private String userId;
    /**
     * 用户类型
     *
     * 枚举 {@link UserTypeEnum}
     */
    private UserTypeEnum userType;
    /**
     * 客户端编号
     *
     * 关联 {@link OrgOAuth2ClientDO#getOrgOauth2ClientId()} ()} ()}
     */
    private String orgOauth2ClientId;
    /**
     * 授权范围
     */
    private String scope;
    /**
     * 是否接受
     *
     * true - 接受
     * false - 拒绝
     */
    private Boolean approved;
    /**
     * 过期时间
     */
    private LocalDateTime expiresTime;

}
